/**
 * 作者:hanbo
 * 日期:2018/12/1916:02
 * 描述:
 */

var map = L.map('map', {
    attributionControl: false,
    zoomControl: true,
    measureControl: true,
    maxZoom: 30,
    minZoom: 3
});
map.fitBounds([
    [30.0887858928, 102.991701371], [31.4403274797, 104.893351918]
]);
map.setZoom(10);
L.marker([30.8, 103.8], {highlight: 'permanent'}).addTo(map);

var imageUrl = 'img/raster.jpg',
    imageBounds = [[30.0887858928, 102.991701371], [31.4403274797, 104.893351918]];
L.imageOverlay(imageUrl, imageBounds).addTo(map);

var timeplay = new TimePlay({
    speed: 2000,//播放速度
    startDate: 20180701,//开始日期
    endDate: 20190131,//结束日期
    timeUnitControl: true,//是否显示时/天切换控件
    onClickChangeEnd: function(){//点击后回调
        //获取点击的时间
        var hour = timeplay.curr_day.hour,//小时
            day  = timeplay.curr_day.day,//日
            mon  = timeplay.curr_day.mon,//月
            year = timeplay.curr_day.year;//年
        console.log(year+"年" + mon + "月" + day + "日" + hour + "时");
    },
    onAnimateEnd: function(){//时间轴动画每次结束回调
        var hour = timeplay.curr_day.hour,//小时
            day  = timeplay.curr_day.day,//日
            mon  = timeplay.curr_day.mon,//月
            year = timeplay.curr_day.year;//年
        console.log(year+"年" + mon + "月" + day + "日" + hour + "时");
    }
});